﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DetMaterial.aspx.cs" Inherits="Gral_DetMaterial" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="../Styles/EstiloModalChilis.css" rel="stylesheet" type="text/css" />
    <title>Recurso - Materiales</title>
</head>
<body style="width:560px">
    <form id="materiales" runat="server">
        <asp:toolkitscriptmanager ID="smRecMaterial" runat="server">
        </asp:toolkitscriptmanager>
        <div id="divModal500">
            <h1>
                Recurso - Materiales
            </h1>
            <table style="table-layout:fixed;width:560px" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td width="80px" class="style1"></td>
                    <td width="100px" class="style1"></td>
                    <td width="5px" class="style1"></td>
                    <td width="85px" class="style1"></td>
                    <td width="100px" class="style1"></td>
                    <td width="5px" class="style1"></td>
                    <td width="85px" class="style1"></td>
                    <td width="100px" class="style1"></td>
                    <td></td>
                </tr>
                <% if (Chilis.Marketing.Common.Constantes.RECURSOMATERIAL_MostrarFiltro(Request.QueryString["acc"]))
                {%>
                <tr>
                    <td colspan="9" class="SubTituloModal">
                        Criterios de Búsqueda
                    </td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <tr>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblDescripcion" runat="server" Text="Descripción"></asp:Label>
                    </td>
                    <td colspan="5">
                        <asp:TextBox ID="txtDescripcion" runat="server" CssClass="txtFiltro" Width="100%"></asp:TextBox>
                    </td>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblUnidad" runat="server" Text="Unidad"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="cmbUnidad" runat="server" CssClass="cmbFiltro" Width="100%">
                            <asp:ListItem Value="0">[NINGUNO]</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <tr>
                    <td colspan="9" align="right"  class="BarraBotones">
                        <asp:Button ID="btnBuscar" runat="server" Text="Buscar" CssClass="boton" 
                            onclick="btnBuscar_Click" />
                        &nbsp;
                        <asp:Button ID="btnLimpiar" runat="server" Text="Limpiar" CssClass="boton" 
                            onclick="btnLimpiar_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <%}%>
                <tr>
                    <td colspan="9">
                        <asp:UpdatePanel ID="upMateriales" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <% if (Chilis.Marketing.Common.Constantes.RECURSOMATERIAL_MostrarFiltro(Request.QueryString["acc"]))
                                {%>
                                <asp:GridView   ID="gvMateriales" 
                                                Width="100%" 
                                                runat="server" 

                                                CssClass="mGrid" 
                                                GridLines="None"
                                                PagerStyle-CssClass="pgr"
                                                AlternatingRowStyle-CssClass="alt"

                                                AutoGenerateColumns="False" 
                                                AllowPaging="True" 
                                                PageSize="4"
                                                CellPadding="0" 
                                                onpageindexchanging="gvMateriales_PageIndexChanging" 
                                                onrowdatabound="gvMateriales_RowDataBound">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Código">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCodigo" runat="server" Text='<%# Bind("id_material") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle Width="10%" HorizontalAlign="Left"/>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Descripción">
                                            <ItemTemplate>
                                                <asp:Label ID="lblDescripcion" runat="server" Text='<%# Bind("descripcion") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle Width="35%" HorizontalAlign="Left"/>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Unidad">
                                            <ItemTemplate>
                                                <asp:Label ID="lblUnidad" runat="server" Text='<%# Bind("unidad") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle Width="30%" HorizontalAlign="Left"/>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Costo">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCosto" runat="server" Text='<%# Bind("costo") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle Width="17%" HorizontalAlign="Left"/>
                                        </asp:TemplateField>
            
                                    
                                        <asp:TemplateField HeaderText="Opciones" ShowHeader="False">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="btnAgregarItem" runat="server" CausesValidation="False" CommandName="AGREGAR_ITEM" Height="24px"  Text="Agregar" Width="24px" ImageUrl="~/Img/imgAgregarItem.png" ToolTip="Agregar" Visible="true"/>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <EmptyDataTemplate>
                                        <asp:Label ID="LblVacio" runat="server" Text="No se encontraron datos"></asp:Label>
                                    </EmptyDataTemplate>
                                    <PagerStyle HorizontalAlign="Center"/>
                                </asp:GridView>

                                <%}%>
                            </ContentTemplate>  
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnBuscar" EventName="Click" />
                                <asp:AsyncPostBackTrigger ControlID="gvMateriales" EventName="PageIndexChanging" />
                                <asp:AsyncPostBackTrigger ControlID="gvMateriales" EventName="RowCommand" />
                            </Triggers>
                        </asp:UpdatePanel>

                    </td>
                </tr>

                <% if (Chilis.Marketing.Common.Constantes.RECURSOMATERIAL_MostrarFiltro(Request.QueryString["acc"]))
                {%>
                <tr>
                    <td colspan="9" class="td_alto DivisionHorizontal">
                    </td>
                </tr>
                <%}%>

                <tr>
                    <td colspan="9" class="SubTituloModal">
                        <asp:Label ID="lblTitulo" runat="server" Text="Detalle Material - Registrar"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <tr>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblCodigoMaterial" runat="server" Text="Código"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtCodigoMaterial" runat="server" CssClass="txtFiltro" Width="100%"></asp:TextBox>
                    </td>
                    <td></td>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblDescripcionMaterial" runat="server" Text="Descripción"></asp:Label>
                    </td>
                    <td colspan="4">
                        <asp:TextBox ID="txtDescripcionMaterial" runat="server" CssClass="txtFiltro" Width="100%"></asp:TextBox>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <tr>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblCantidad" runat="server" Text="Cantidad"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtCantidad" runat="server" CssClass="txtFiltro" Width="100%"></asp:TextBox>
                    </td>
                    <td></td>
                    <td colspan="2">
                        <asp:HiddenField ID="txtIdRecursoMaterial" runat="server" />
                    </td>
                    <td></td>
                    <td class="td_campoFiltro">
                        <asp:Label ID="lblCosto" runat="server" Text="Costo Por Unidad (S/.)"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtCosto" runat="server" CssClass="txtFiltro" Width="100%"></asp:TextBox>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="9" class="td_alto">
                    </td>
                </tr>
                <tr>
                    <td colspan="9" align="center" class="BarraBotones">
                        <asp:Button ID="btnAceptar" runat="server" Text="Aceptar" CssClass="boton" 
                            onclick="btnAceptar_Click"/>
                        &nbsp;
                        <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" CssClass="boton" OnClientClick="self.parent.tb_remove();"/>
                    </td>
                </tr>
            </table>

        </div>
        
    </form>
</body>
</html>
